<%--
  Created by IntelliJ IDEA.
  User: ssw
  Date: 2018/6/12
  Time: 10:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>学生成绩管理系统v1.0-管理员界面</title>
</head>
<body>
欢迎您：${user.uname}(${user.uid})</br>
<h1>添加教师授课</h1></br>
<a href="/sgms/adminUI.jsp"> 回到上一页 </a></br>
<%--<%--%>
    <%--if(request.getAttribute("courseList")==null)--%>
<%--%>--%>
<%--<%--%>
    <%--if(request.getAttribute("lecList")==null)--%>
        <%--request.getRequestDispatcher("/askLec&from=admin_addsc").forward(request, response);--%>
<%--%>--%>
<%--<%--%>
    <%--if(request.getAttribute("classList")==null)--%>
        <%--request.getRequestDispatcher("/askclass&from=admin_addsc").forward(request, response);--%>
<%--%>--%>

<c:if test="${empty courseList}">
    <jsp:forward page="/askCourse">
        <jsp:param name="from" value="admin_addsc"></jsp:param>
    </jsp:forward>
</c:if>
<c:if test="${empty lecList}">
    <jsp:forward page="/askLec"></jsp:forward>
</c:if>
<c:if test="${empty classList}">
    <jsp:forward page="/askclass">
        <jsp:param name="from" value="admin_addsc"></jsp:param>
    </jsp:forward>
</c:if>



<form action="/addsc">
    <tr>
        <td>课程编号：</td>
        <td>
            <select name="cname">
                <c:forEach items="${courseList}" var="course">
                    <option value=${course.cno}>${course.cname}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>授课教师工号：</td>
        <td>
            <select name="lname">
                <c:forEach items="${lecList}" var="lec">
                    <option value=${lec.lid}>${lec.lid}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>班级编号：</td>
        <td>
            <select name="clname">
                <c:forEach items="${classList}" var="cls">
                    <option value=${cls.clname}>${cls.clname}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    </br>
    <tr>
        <td>授课地点：</td>
        <td><input type="text" name="scroom"></td>
    </tr>
    <tr>
        <td>授课时间：</td>
        <td><input type="text" name="sctime"></td>
    </tr>

    <tr>
        <td>学分:</td>
        <td>
            <select name="sccredit">
                <option value=1>1学分</option>
                <option value=2>2学分</option>
                <option value=3>3学分</option>
                <option value=4>4学分</option>
                <option value=5>5学分</option>
            </select>
        </td>
    </tr>
    <input type="submit" value="提交">
</form>
<%
    if(request.getParameter("res")!=null){
        if(request.getParameter("res").equals("1")){
            out.println("添加选课成功");
        }
        else{
            out.println("添加选课失败");
        }
    }
%>
</body>
</html>
